//
//  ViewController.m
//  QQMusic
//
//  Created by 苗钧豪 on 16/7/19.
//  Copyright © 2016年 苗钧豪. All rights reserved.
//

#import "ViewController.h"
#import <QuartzCore/QuartzCore.h>
#import "Masonry.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
#pragma mark ================ 1、设置背景图片 ================
    UIImageView *backimgview = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"背景.jpg"]];
    [self.view addSubview:backimgview];
    [backimgview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.bottom.mas_equalTo(0);
    }];
    backimgview.userInteractionEnabled = YES;
#pragma mark ================ 2、放置一个view ================
    UIView *myView = [UIView new];
    [backimgview addSubview:myView];
    [myView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(60);
        make.top.mas_equalTo(130);
        make.width.mas_equalTo(300);
        make.height.mas_equalTo(300);
    }];
    UIImageView *imgview = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"模特.jpg"]];
    [myView addSubview:imgview];
    [imgview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(0);
        make.width.mas_equalTo(myView.mas_width);
        make.height.mas_equalTo(myView.mas_height);
    }];
    myView.layer.cornerRadius = 150;
    myView.layer.masksToBounds = YES;
#pragma mark ================ 3、布置周围的控件 ================
    UIButton *downbtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [backimgview addSubview:downbtn];
    [downbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(25);
        make.width.mas_equalTo(35);
        make.height.mas_equalTo(30);
    }];
    [downbtn setBackgroundImage:[UIImage imageNamed:@"下拉1.png"] forState:(UIControlStateNormal)];
    
    UIButton *morebtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [backimgview addSubview:morebtn];
    [morebtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(350);
        make.top.mas_equalTo(25);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(30);
    }];
    [morebtn setBackgroundImage:[UIImage imageNamed:@"更多1.png"] forState:(UIControlStateNormal)];
    
    UIButton *HQbtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [backimgview addSubview:HQbtn];
    [HQbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(90);
        make.top.mas_equalTo(95);
        make.width.mas_equalTo(55);
        make.height.mas_equalTo(25);
    }];
    [HQbtn setBackgroundImage:[UIImage imageNamed:@"HQ.png"] forState:(UIControlStateNormal)];
    
    UIButton *onebtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [backimgview addSubview:onebtn];
    [onebtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(155);
        make.top.mas_equalTo(95);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(25);
    }];
    [onebtn setBackgroundImage:[UIImage imageNamed:@"独家.png"] forState:(UIControlStateNormal)];
    
    UIButton *MVbtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [backimgview addSubview:MVbtn];
    [MVbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(215);
        make.top.mas_equalTo(95);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(25);
    }];
    [MVbtn setBackgroundImage:[UIImage imageNamed:@"MV.png"] forState:(UIControlStateNormal)];
    
    UIButton *dtsbtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [backimgview addSubview:dtsbtn];
    [dtsbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(275);
        make.top.mas_equalTo(95);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(25);
    }];
    [dtsbtn setTitle:@"dts" forState:(UIControlStateNormal)];
    
    UILabel *musiclabel = [UILabel new];
    [backimgview addSubview:musiclabel];
    [musiclabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(190);
        make.top.mas_equalTo(20);
        make.width.mas_equalTo(60);
        make.height.mas_equalTo(30);
    }];
    musiclabel.text = @"模特";
    musiclabel.textColor = [UIColor whiteColor];
    
    UILabel *namelabel = [UILabel new];
    [backimgview addSubview:namelabel];
    [namelabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(160);
        make.top.mas_equalTo(50);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(30);
    }];
    namelabel.text = @"— 李荣浩 —";
    namelabel.textColor = [UIColor whiteColor];
    
    UILabel *textlabel = [UILabel new];
    [backimgview addSubview:textlabel];
    [textlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(110);
        make.top.mas_equalTo(450);
        make.width.mas_equalTo(250);
        make.height.mas_equalTo(30);
    }];
    textlabel.text = @"没什么 至少证明我们还活着";
    textlabel.textColor = [UIColor lightGrayColor];
    
    UIPageControl *page = [UIPageControl new];
    [backimgview addSubview:page];
    [page mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(185);
        make.top.mas_equalTo(485);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(30);
    }];
    page.currentPage = 1;
    page.numberOfPages = 3;
    
    UIPageControl *page1 = [UIPageControl new];
    [backimgview addSubview:page1];
    [page1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(120);
        make.top.mas_equalTo(550);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(30);
    }];
    page1.numberOfPages = 1;
    [page1 sizeForNumberOfPages:0.1];
    
    UISlider *slider = [UISlider new];
    [backimgview addSubview:slider];
    [slider mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(70);
        make.top.mas_equalTo(550);
        make.width.mas_equalTo(270);
        make.height.mas_equalTo(30);
    }];
    [slider setMinimumTrackImage:[UIImage imageNamed:@"滑动左视图"] forState:(UIControlStateNormal)];
    [slider setThumbImage:[UIImage imageNamed:@"滑块"] forState:(UIControlStateNormal)];
    slider.value = 0.75;
    
    UILabel *leftlabel = [UILabel new];
    [backimgview addSubview:leftlabel];
    [leftlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.top.mas_equalTo(550);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(30);
    }];
    leftlabel.text = @"03:51";
    leftlabel.textColor = [UIColor lightGrayColor];
    
    UILabel *rightlabel = [UILabel new];
    [backimgview addSubview:rightlabel];
    [rightlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(345);
        make.top.mas_equalTo(550);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(30);
    }];
    rightlabel.text = @"05:06";
    rightlabel.textColor = [UIColor lightGrayColor];
    
    UIButton *playbtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [playbtn setBackgroundImage:[UIImage imageNamed:@"播放"] forState:(UIControlStateNormal)];
    [backimgview addSubview:playbtn];
    [playbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(160);
        make.top.mas_equalTo(580);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(100);
    }];
    
    UIButton *playbtn1 = [UIButton buttonWithType:UIButtonTypeCustom];
    [playbtn1 setBackgroundImage:[UIImage imageNamed:@"上一首"] forState:(UIControlStateNormal)];
    [backimgview addSubview:playbtn1];
    [playbtn1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(70);
        make.top.mas_equalTo(590);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(80);
    }];
    
    UIButton *playbtn2 = [UIButton buttonWithType:UIButtonTypeCustom];
    [playbtn2 setBackgroundImage:[UIImage imageNamed:@"下一首"] forState:(UIControlStateNormal)];
    [backimgview addSubview:playbtn2];
    [playbtn2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(270);
        make.top.mas_equalTo(590);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(80);
    }];

    UIButton *btn1 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [btn1 setBackgroundImage:[UIImage imageNamed:@"喜欢1"] forState:(UIControlStateNormal)];
    [backimgview addSubview:btn1];
    [btn1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(30);
        make.top.mas_equalTo(680);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(40);
    }];
    
    UIButton *btn2 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [btn2 setBackgroundImage:[UIImage imageNamed:@"循环1"] forState:(UIControlStateNormal)];
    [backimgview addSubview:btn2];
    [btn2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(110);
        make.top.mas_equalTo(680);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(40);
    }];
    
    UIButton *btn3 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [btn3 setBackgroundImage:[UIImage imageNamed:@"下载1"] forState:(UIControlStateNormal)];
    [backimgview addSubview:btn3];
    [btn3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(190);
        make.top.mas_equalTo(680);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(40);
    }];
    
    UIButton *btn4 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [btn4 setBackgroundImage:[UIImage imageNamed:@"分享1"] forState:(UIControlStateNormal)];
    [backimgview addSubview:btn4];
    [btn4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(270);
        make.top.mas_equalTo(680);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(40);
    }];
    
    UIButton *btn5 = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [btn5 setBackgroundImage:[UIImage imageNamed:@"音乐1"] forState:(UIControlStateNormal)];
    [backimgview addSubview:btn5];
    [btn5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(350);
        make.top.mas_equalTo(680);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(40);
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
